#!/bin/sh

BASE_PATH="/home/shopnc/tf/local"
FILE_PATH="file.txt"

#echo -n "Please enter file path:"
#read FILE_PATH

	for file_item in $(find $BASE_PATH -type f); do
		file="${PWD}/$file_item"
		file=`echo ${file##*$LOCAL_PATH}`
		local_file_list[$file_count]="$file"
		file_count=`expr $file_count + 1`
		echo "$file_item"
	done

exit 0
while [ ! "$FILE_PATH" ]
do
	echo -n "Please enter file path:"
	echo ""
	read FILE_PATH
	while [ ! -f "$FILE_PATH" ]
	do
		echo -n "Please enter a valid file path:"
		echo ""
		read FILE_PATH
	done
done

line_number=0
line_count=`sed -n '$=' $FILE_PATH`
tmp_path=""
tmp_base_path=""
while read LINE
do
	if [ "$LINE" ]; then
		if [ ${LINE:0:1} = "\$" ]; then
			if [ $line_number = 0 ]; then
				tmp_base_path=`echo ${LINE%:*}`
				tmp_path="$tmp_base_path"
			else
				tmp_path=`echo ${LINE%:*}`
			fi
			if [ ${LINE:0:2} != "\$/" ]; then
				tmp_path=`echo ${tmp_path##*$}`
				tmp_path="$tmp_base_path/$tmp_path"
			fi
		else
			if [ $line_number -lt `expr $line_count - 1` ]; then
				LINE=`echo ${LINE##*$}`
				file="$tmp_path/$LINE"
				file=`echo ${file##*$tmp_base_path}`
				echo "File: $file"
			fi
		fi
	fi
	line_number=`expr $line_number + 1`
done < $FILE_PATH
echo "$tmp_base_path"

exit 0

get_local_all_file_list(){
	local_files=`ls`

	for file_item in $local_files; do
		if [ -d "$file_item" ]; then
			cd "$file_item"
			get_local_all_file_list
		else
			#echo "${PWD}/$file_item"
			file_list[$file_count]="${PWD}/$file_item"
			file_count=`expr $file_count + 1`
		fi
	done
}
file_count=0
file_list=()
get_local_all_file_list

for (( j=0; j<"$file_count"; j=j+1 )); do
	echo ${file_list[$j]}
done
exit 0
